home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / info / lispref.info-31.z / lispref.info-31
Encoding:
GNU Info File  |  1998-05-21  |  48.6 KB  |  1,162 lines

  1. This is Info file ../../info/lispref.info, produced by Makeinfo version
  2. 1.68 from the input file lispref.texi.
  3.  
  4.    Edition History:
  5.  
  6.    GNU Emacs Lisp Reference Manual Second Edition (v2.01), May 1993 GNU
  7. Emacs Lisp Reference Manual Further Revised (v2.02), August 1993 Lucid
  8. Emacs Lisp Reference Manual (for 19.10) First Edition, March 1994
  9. XEmacs Lisp Programmer's Manual (for 19.12) Second Edition, April 1995
  10. GNU Emacs Lisp Reference Manual v2.4, June 1995 XEmacs Lisp
  11. Programmer's Manual (for 19.13) Third Edition, July 1995 XEmacs Lisp
  12. Reference Manual (for 19.14 and 20.0) v3.1, March 1996 XEmacs Lisp
  13. Reference Manual (for 19.15 and 20.1, 20.2) v3.2, April, May 1997
  14.  
  15.    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software
  16. Foundation, Inc.  Copyright (C) 1994, 1995 Sun Microsystems, Inc.
  17. Copyright (C) 1995, 1996 Ben Wing.
  18.  
  19.    Permission is granted to make and distribute verbatim copies of this
  20. manual provided the copyright notice and this permission notice are
  21. preserved on all copies.
  22.  
  23.    Permission is granted to copy and distribute modified versions of
  24. this manual under the conditions for verbatim copying, provided that the
  25. entire resulting derived work is distributed under the terms of a
  26. permission notice identical to this one.
  27.  
  28.    Permission is granted to copy and distribute translations of this
  29. manual into another language, under the above conditions for modified
  30. versions, except that this permission notice may be stated in a
  31. translation approved by the Foundation.
  32.  
  33.    Permission is granted to copy and distribute modified versions of
  34. this manual under the conditions for verbatim copying, provided also
  35. that the section entitled "GNU General Public License" is included
  36. exactly as in the original, and provided that the entire resulting
  37. derived work is distributed under the terms of a permission notice
  38. identical to this one.
  39.  
  40.    Permission is granted to copy and distribute translations of this
  41. manual into another language, under the above conditions for modified
  42. versions, except that the section entitled "GNU General Public License"
  43. may be included in a translation approved by the Free Software
  44. Foundation instead of in the original English.
  45.  
  46. 
  47. File: lispref.info,  Node: Syntax Basics,  Next: Syntax Descriptors,  Up: Syntax Tables
  48.  
  49. Syntax Table Concepts
  50. =====================
  51.  
  52.    A "syntax table" provides Emacs with the information that determines
  53. the syntactic use of each character in a buffer.  This information is
  54. used by the parsing commands, the complex movement commands, and others
  55. to determine where words, symbols, and other syntactic constructs begin
  56. and end.  The current syntax table controls the meaning of the word
  57. motion functions (*note Word Motion::.) and the list motion functions
  58. (*note List Motion::.) as well as the functions in this chapter.
  59.  
  60.    Under XEmacs 20, a syntax table is a particular subtype of the
  61. primitive char table type (*note Char Tables::.), and each element of
  62. the char table is an integer that encodes the syntax of the character in
  63. question, or a cons of such an integer and a matching character (for
  64. characters with parenthesis syntax).
  65.  
  66.    Under XEmacs 19, a syntax table is a vector of 256 elements; it
  67. contains one entry for each of the 256 possible characters in an 8-bit
  68. byte.  Each element is an integer that encodes the syntax of the
  69. character in question. (The matching character, if any, is embedded in
  70. the bits of this integer.)
  71.  
  72.    Syntax tables are used only for moving across text, not for the Emacs
  73. Lisp reader.  XEmacs Lisp uses built-in syntactic rules when reading
  74. Lisp expressions, and these rules cannot be changed.
  75.  
  76.    Each buffer has its own major mode, and each major mode has its own
  77. idea of the syntactic class of various characters.  For example, in Lisp
  78. mode, the character `;' begins a comment, but in C mode, it terminates
  79. a statement.  To support these variations, XEmacs makes the choice of
  80. syntax table local to each buffer.  Typically, each major mode has its
  81. own syntax table and installs that table in each buffer that uses that
  82. mode.  Changing this table alters the syntax in all those buffers as
  83. well as in any buffers subsequently put in that mode.  Occasionally
  84. several similar modes share one syntax table.  *Note Example Major
  85. Modes::, for an example of how to set up a syntax table.
  86.  
  87.    A syntax table can inherit the data for some characters from the
  88. standard syntax table, while specifying other characters itself.  The
  89. "inherit" syntax class means "inherit this character's syntax from the
  90. standard syntax table."  Most major modes' syntax tables inherit the
  91. syntax of character codes 0 through 31 and 128 through 255.  This is
  92. useful with character sets such as ISO Latin-1 that have additional
  93. alphabetic characters in the range 128 to 255.  Just changing the
  94. standard syntax for these characters affects all major modes.
  95.  
  96.  - Function: syntax-table-p OBJECT
  97.      This function returns `t' if OBJECT is a vector of length 256
  98.      elements.  This means that the vector may be a syntax table.
  99.      However, according to this test, any vector of length 256 is
  100.      considered to be a syntax table, no matter what its contents.
  101.  
  102. 
  103. File: lispref.info,  Node: Syntax Descriptors,  Next: Syntax Table Functions,  Prev: Syntax Basics,  Up: Syntax Tables
  104.  
  105. Syntax Descriptors
  106. ==================
  107.  
  108.    This section describes the syntax classes and flags that denote the
  109. syntax of a character, and how they are represented as a "syntax
  110. descriptor", which is a Lisp string that you pass to
  111. `modify-syntax-entry' to specify the desired syntax.
  112.  
  113.    XEmacs defines a number of "syntax classes".  Each syntax table puts
  114. each character into one class.  There is no necessary relationship
  115. between the class of a character in one syntax table and its class in
  116. any other table.
  117.  
  118.    Each class is designated by a mnemonic character, which serves as the
  119. name of the class when you need to specify a class.  Usually the
  120. designator character is one that is frequently in that class; however,
  121. its meaning as a designator is unvarying and independent of what syntax
  122. that character currently has.
  123.  
  124.    A syntax descriptor is a Lisp string that specifies a syntax class, a
  125. matching character (used only for the parenthesis classes) and flags.
  126. The first character is the designator for a syntax class.  The second
  127. character is the character to match; if it is unused, put a space there.
  128. Then come the characters for any desired flags.  If no matching
  129. character or flags are needed, one character is sufficient.
  130.  
  131.    For example, the descriptor for the character `*' in C mode is
  132. `. 23' (i.e., punctuation, matching character slot unused, second
  133. character of a comment-starter, first character of an comment-ender),
  134. and the entry for `/' is `. 14' (i.e., punctuation, matching character
  135. slot unused, first character of a comment-starter, second character of
  136. a comment-ender).
  137.  
  138. * Menu:
  139.  
  140. * Syntax Class Table::      Table of syntax classes.
  141. * Syntax Flags::            Additional flags each character can have.
  142.  
  143. 
  144. File: lispref.info,  Node: Syntax Class Table,  Next: Syntax Flags,  Up: Syntax Descriptors
  145.  
  146. Table of Syntax Classes
  147. -----------------------
  148.  
  149.    Here is a table of syntax classes, the characters that stand for
  150. them, their meanings, and examples of their use.
  151.  
  152.  - Syntax class: whitespace character
  153.      "Whitespace characters" (designated with ` ' or `-') separate
  154.      symbols and words from each other.  Typically, whitespace
  155.      characters have no other syntactic significance, and multiple
  156.      whitespace characters are syntactically equivalent to a single
  157.      one.  Space, tab, newline and formfeed are almost always
  158.      classified as whitespace.
  159.  
  160.  - Syntax class: word constituent
  161.      "Word constituents" (designated with `w') are parts of normal
  162.      English words and are typically used in variable and command names
  163.      in programs.  All upper- and lower-case letters, and the digits,
  164.      are typically word constituents.
  165.  
  166.  - Syntax class: symbol constituent
  167.      "Symbol constituents" (designated with `_') are the extra
  168.      characters that are used in variable and command names along with
  169.      word constituents.  For example, the symbol constituents class is
  170.      used in Lisp mode to indicate that certain characters may be part
  171.      of symbol names even though they are not part of English words.
  172.      These characters are `$&*+-_<>'.  In standard C, the only
  173.      non-word-constituent character that is valid in symbols is
  174.      underscore (`_').
  175.  
  176.  - Syntax class: punctuation character
  177.      "Punctuation characters" (`.') are those characters that are used
  178.      as punctuation in English, or are used in some way in a programming
  179.      language to separate symbols from one another.  Most programming
  180.      language modes, including Emacs Lisp mode, have no characters in
  181.      this class since the few characters that are not symbol or word
  182.      constituents all have other uses.
  183.  
  184.  - Syntax class: open parenthesis character
  185.  - Syntax class: close parenthesis character
  186.      Open and close "parenthesis characters" are characters used in
  187.      dissimilar pairs to surround sentences or expressions.  Such a
  188.      grouping is begun with an open parenthesis character and
  189.      terminated with a close.  Each open parenthesis character matches
  190.      a particular close parenthesis character, and vice versa.
  191.      Normally, XEmacs indicates momentarily the matching open
  192.      parenthesis when you insert a close parenthesis.  *Note Blinking::.
  193.  
  194.      The class of open parentheses is designated with `(', and that of
  195.      close parentheses with `)'.
  196.  
  197.      In English text, and in C code, the parenthesis pairs are `()',
  198.      `[]', and `{}'.  In XEmacs Lisp, the delimiters for lists and
  199.      vectors (`()' and `[]') are classified as parenthesis characters.
  200.  
  201.  - Syntax class: string quote
  202.      "String quote characters" (designated with `"') are used in many
  203.      languages, including Lisp and C, to delimit string constants.  The
  204.      same string quote character appears at the beginning and the end
  205.      of a string.  Such quoted strings do not nest.
  206.  
  207.      The parsing facilities of XEmacs consider a string as a single
  208.      token.  The usual syntactic meanings of the characters in the
  209.      string are suppressed.
  210.  
  211.      The Lisp modes have two string quote characters: double-quote (`"')
  212.      and vertical bar (`|').  `|' is not used in XEmacs Lisp, but it is
  213.      used in Common Lisp.  C also has two string quote characters:
  214.      double-quote for strings, and single-quote (`'') for character
  215.      constants.
  216.  
  217.      English text has no string quote characters because English is not
  218.      a programming language.  Although quotation marks are used in
  219.      English, we do not want them to turn off the usual syntactic
  220.      properties of other characters in the quotation.
  221.  
  222.  - Syntax class: escape
  223.      An "escape character" (designated with `\') starts an escape
  224.      sequence such as is used in C string and character constants.  The
  225.      character `\' belongs to this class in both C and Lisp.  (In C, it
  226.      is used thus only inside strings, but it turns out to cause no
  227.      trouble to treat it this way throughout C code.)
  228.  
  229.      Characters in this class count as part of words if
  230.      `words-include-escapes' is non-`nil'.  *Note Word Motion::.
  231.  
  232.  - Syntax class: character quote
  233.      A "character quote character" (designated with `/') quotes the
  234.      following character so that it loses its normal syntactic meaning.
  235.      This differs from an escape character in that only the character
  236.      immediately following is ever affected.
  237.  
  238.      Characters in this class count as part of words if
  239.      `words-include-escapes' is non-`nil'.  *Note Word Motion::.
  240.  
  241.      This class is used for backslash in TeX mode.
  242.  
  243.  - Syntax class: paired delimiter
  244.      "Paired delimiter characters" (designated with `$') are like
  245.      string quote characters except that the syntactic properties of the
  246.      characters between the delimiters are not suppressed.  Only TeX
  247.      mode uses a paired delimiter presently--the `$' that both enters
  248.      and leaves math mode.
  249.  
  250.  - Syntax class: expression prefix
  251.      An "expression prefix operator" (designated with `'') is used for
  252.      syntactic operators that are part of an expression if they appear
  253.      next to one.  These characters in Lisp include the apostrophe, `''
  254.      (used for quoting), the comma, `,' (used in macros), and `#' (used
  255.      in the read syntax for certain data types).
  256.  
  257.  - Syntax class: comment starter
  258.  - Syntax class: comment ender
  259.      The "comment starter" and "comment ender" characters are used in
  260.      various languages to delimit comments.  These classes are
  261.      designated with `<' and `>', respectively.
  262.  
  263.      English text has no comment characters.  In Lisp, the semicolon
  264.      (`;') starts a comment and a newline or formfeed ends one.
  265.  
  266.  - Syntax class: inherit
  267.      This syntax class does not specify a syntax.  It says to look in
  268.      the standard syntax table to find the syntax of this character.
  269.      The designator for this syntax code is `@'.
  270.  
  271. 
  272. File: lispref.info,  Node: Syntax Flags,  Prev: Syntax Class Table,  Up: Syntax Descriptors
  273.  
  274. Syntax Flags
  275. ------------
  276.  
  277.    In addition to the classes, entries for characters in a syntax table
  278. can include flags.  There are six possible flags, represented by the
  279. characters `1', `2', `3', `4', `b' and `p'.
  280.  
  281.    All the flags except `p' are used to describe multi-character
  282. comment delimiters.  The digit flags indicate that a character can
  283. *also* be part of a comment sequence, in addition to the syntactic
  284. properties associated with its character class.  The flags are
  285. independent of the class and each other for the sake of characters such
  286. as `*' in C mode, which is a punctuation character, *and* the second
  287. character of a start-of-comment sequence (`/*'), *and* the first
  288. character of an end-of-comment sequence (`*/').
  289.  
  290.    The flags for a character C are:
  291.  
  292.    * `1' means C is the start of a two-character comment-start sequence.
  293.  
  294.    * `2' means C is the second character of such a sequence.
  295.  
  296.    * `3' means C is the start of a two-character comment-end sequence.
  297.  
  298.    * `4' means C is the second character of such a sequence.
  299.  
  300.    * `b' means that C as a comment delimiter belongs to the alternative
  301.      "b" comment style.
  302.  
  303.      Emacs supports two comment styles simultaneously in any one syntax
  304.      table.  This is for the sake of C++.  Each style of comment syntax
  305.      has its own comment-start sequence and its own comment-end
  306.      sequence.  Each comment must stick to one style or the other;
  307.      thus, if it starts with the comment-start sequence of style "b",
  308.      it must also end with the comment-end sequence of style "b".
  309.  
  310.      The two comment-start sequences must begin with the same
  311.      character; only the second character may differ.  Mark the second
  312.      character of the "b"-style comment-start sequence with the `b'
  313.      flag.
  314.  
  315.      A comment-end sequence (one or two characters) applies to the "b"
  316.      style if its first character has the `b' flag set; otherwise, it
  317.      applies to the "a" style.
  318.  
  319.      The appropriate comment syntax settings for C++ are as follows:
  320.  
  321.     `/'
  322.           `124b'
  323.  
  324.     `*'
  325.           `23'
  326.  
  327.     newline
  328.           `>b'
  329.  
  330.      This defines four comment-delimiting sequences:
  331.  
  332.     `/*'
  333.           This is a comment-start sequence for "a" style because the
  334.           second character, `*', does not have the `b' flag.
  335.  
  336.     `//'
  337.           This is a comment-start sequence for "b" style because the
  338.           second character, `/', does have the `b' flag.
  339.  
  340.     `*/'
  341.           This is a comment-end sequence for "a" style because the first
  342.           character, `*', does not have the `b' flag
  343.  
  344.     newline
  345.           This is a comment-end sequence for "b" style, because the
  346.           newline character has the `b' flag.
  347.  
  348.    * `p' identifies an additional "prefix character" for Lisp syntax.
  349.      These characters are treated as whitespace when they appear between
  350.      expressions.  When they appear within an expression, they are
  351.      handled according to their usual syntax codes.
  352.  
  353.      The function `backward-prefix-chars' moves back over these
  354.      characters, as well as over characters whose primary syntax class
  355.      is prefix (`'').  *Note Motion and Syntax::.
  356.  
  357. 
  358. File: lispref.info,  Node: Syntax Table Functions,  Next: Motion and Syntax,  Prev: Syntax Descriptors,  Up: Syntax Tables
  359.  
  360. Syntax Table Functions
  361. ======================
  362.  
  363.    In this section we describe functions for creating, accessing and
  364. altering syntax tables.
  365.  
  366.  - Function: make-syntax-table &optional TABLE
  367.      This function creates a new syntax table.  Character codes 0
  368.      through 31 and 128 through 255 are set up to inherit from the
  369.      standard syntax table.  The other character codes are set up by
  370.      copying what the standard syntax table says about them.
  371.  
  372.      Most major mode syntax tables are created in this way.
  373.  
  374.  - Function: copy-syntax-table &optional TABLE
  375.      This function constructs a copy of TABLE and returns it.  If TABLE
  376.      is not supplied (or is `nil'), it returns a copy of the current
  377.      syntax table.  Otherwise, an error is signaled if TABLE is not a
  378.      syntax table.
  379.  
  380.  - Command: modify-syntax-entry CHAR SYNTAX-DESCRIPTOR &optional TABLE
  381.      This function sets the syntax entry for CHAR according to
  382.      SYNTAX-DESCRIPTOR.  The syntax is changed only for TABLE, which
  383.      defaults to the current buffer's syntax table, and not in any
  384.      other syntax table.  The argument SYNTAX-DESCRIPTOR specifies the
  385.      desired syntax; this is a string beginning with a class designator
  386.      character, and optionally containing a matching character and
  387.      flags as well.  *Note Syntax Descriptors::.
  388.  
  389.      This function always returns `nil'.  The old syntax information in
  390.      the table for this character is discarded.
  391.  
  392.      An error is signaled if the first character of the syntax
  393.      descriptor is not one of the twelve syntax class designator
  394.      characters.  An error is also signaled if CHAR is not a character.
  395.  
  396.      Examples:
  397.  
  398.           ;; Put the space character in class whitespace.
  399.           (modify-syntax-entry ?\  " ")
  400.                => nil
  401.           
  402.           ;; Make `$' an open parenthesis character,
  403.           ;;   with `^' as its matching close.
  404.           (modify-syntax-entry ?$ "(^")
  405.                => nil
  406.           
  407.           ;; Make `^' a close parenthesis character,
  408.           ;;   with `$' as its matching open.
  409.           (modify-syntax-entry ?^ ")$")
  410.                => nil
  411.           
  412.           ;; Make `/' a punctuation character,
  413.           ;;   the first character of a start-comment sequence,
  414.           ;;   and the second character of an end-comment sequence.
  415.           ;;   This is used in C mode.
  416.           (modify-syntax-entry ?/ ". 14")
  417.                => nil
  418.  
  419.  - Function: char-syntax CHARACTER
  420.      This function returns the syntax class of CHARACTER, represented
  421.      by its mnemonic designator character.  This *only* returns the
  422.      class, not any matching parenthesis or flags.
  423.  
  424.      An error is signaled if CHAR is not a character.
  425.  
  426.      The following examples apply to C mode.  The first example shows
  427.      that the syntax class of space is whitespace (represented by a
  428.      space).  The second example shows that the syntax of `/' is
  429.      punctuation.  This does not show the fact that it is also part of
  430.      comment-start and -end sequences.  The third example shows that
  431.      open parenthesis is in the class of open parentheses.  This does
  432.      not show the fact that it has a matching character, `)'.
  433.  
  434.           (char-to-string (char-syntax ?\ ))
  435.                => " "
  436.           
  437.           (char-to-string (char-syntax ?/))
  438.                => "."
  439.           
  440.           (char-to-string (char-syntax ?\())
  441.                => "("
  442.  
  443.  - Function: set-syntax-table TABLE &optional BUFFER
  444.      This function makes TABLE the syntax table for BUFFER, which
  445.      defaults to the current buffer if omitted.  It returns TABLE.
  446.  
  447.  - Function: syntax-table &optional BUFFER
  448.      This function returns the syntax table for BUFFER, which defaults
  449.      to the current buffer if omitted.
  450.  
  451. 
  452. File: lispref.info,  Node: Motion and Syntax,  Next: Parsing Expressions,  Prev: Syntax Table Functions,  Up: Syntax Tables
  453.  
  454. Motion and Syntax
  455. =================
  456.  
  457.    This section describes functions for moving across characters in
  458. certain syntax classes.  None of these functions exists in Emacs
  459. version 18 or earlier.
  460.  
  461.  - Function: skip-syntax-forward SYNTAXES &optional LIMIT BUFFER
  462.      This function moves point forward across characters having syntax
  463.      classes mentioned in SYNTAXES.  It stops when it encounters the
  464.      end of the buffer, or position LIMIT (if specified), or a
  465.      character it is not supposed to skip.  Optional argument BUFFER
  466.      defaults to the current buffer if omitted.
  467.  
  468.  - Function: skip-syntax-backward SYNTAXES &optional LIMIT BUFFER
  469.      This function moves point backward across characters whose syntax
  470.      classes are mentioned in SYNTAXES.  It stops when it encounters
  471.      the beginning of the buffer, or position LIMIT (if specified), or a
  472.      character it is not supposed to skip.  Optional argument BUFFER
  473.      defaults to the current buffer if omitted.
  474.  
  475.  
  476.  - Function: backward-prefix-chars &optional BUFFER
  477.      This function moves point backward over any number of characters
  478.      with expression prefix syntax.  This includes both characters in
  479.      the expression prefix syntax class, and characters with the `p'
  480.      flag.  Optional argument BUFFER defaults to the current buffer if
  481.      omitted.
  482.  
  483. 
  484. File: lispref.info,  Node: Parsing Expressions,  Next: Standard Syntax Tables,  Prev: Motion and Syntax,  Up: Syntax Tables
  485.  
  486. Parsing Balanced Expressions
  487. ============================
  488.  
  489.    Here are several functions for parsing and scanning balanced
  490. expressions, also known as "sexps", in which parentheses match in
  491. pairs.  The syntax table controls the interpretation of characters, so
  492. these functions can be used for Lisp expressions when in Lisp mode and
  493. for C expressions when in C mode.  *Note List Motion::, for convenient
  494. higher-level functions for moving over balanced expressions.
  495.  
  496.  - Function: parse-partial-sexp START LIMIT &optional TARGET-DEPTH
  497.           STOP-BEFORE STATE STOP-COMMENT BUFFER
  498.      This function parses a sexp in the current buffer starting at
  499.      START, not scanning past LIMIT.  It stops at position LIMIT or
  500.      when certain criteria described below are met, and sets point to
  501.      the location where parsing stops.  It returns a value describing
  502.      the status of the parse at the point where it stops.
  503.  
  504.      If STATE is `nil', START is assumed to be at the top level of
  505.      parenthesis structure, such as the beginning of a function
  506.      definition.  Alternatively, you might wish to resume parsing in the
  507.      middle of the structure.  To do this, you must provide a STATE
  508.      argument that describes the initial status of parsing.
  509.  
  510.      If the third argument TARGET-DEPTH is non-`nil', parsing stops if
  511.      the depth in parentheses becomes equal to TARGET-DEPTH.  The depth
  512.      starts at 0, or at whatever is given in STATE.
  513.  
  514.      If the fourth argument STOP-BEFORE is non-`nil', parsing stops
  515.      when it comes to any character that starts a sexp.  If
  516.      STOP-COMMENT is non-`nil', parsing stops when it comes to the
  517.      start of a comment.
  518.  
  519.      The fifth argument STATE is an eight-element list of the same form
  520.      as the value of this function, described below.  The return value
  521.      of one call may be used to initialize the state of the parse on
  522.      another call to `parse-partial-sexp'.
  523.  
  524.      The result is a list of eight elements describing the final state
  525.      of the parse:
  526.  
  527.        0. The depth in parentheses, counting from 0.
  528.  
  529.        1. The character position of the start of the innermost
  530.           parenthetical grouping containing the stopping point; `nil'
  531.           if none.
  532.  
  533.        2. The character position of the start of the last complete
  534.           subexpression terminated; `nil' if none.
  535.  
  536.        3. Non-`nil' if inside a string.  More precisely, this is the
  537.           character that will terminate the string.
  538.  
  539.        4. `t' if inside a comment (of either style).
  540.  
  541.        5. `t' if point is just after a quote character.
  542.  
  543.        6. The minimum parenthesis depth encountered during this scan.
  544.  
  545.        7. `t' if inside a comment of style "b".
  546.  
  547.      Elements 0, 3, 4, 5 and 7 are significant in the argument STATE.
  548.  
  549.      This function is most often used to compute indentation for
  550.      languages that have nested parentheses.
  551.  
  552.  - Function: scan-lists FROM COUNT DEPTH &optional BUFFER NOERROR
  553.      This function scans forward COUNT balanced parenthetical groupings
  554.      from character number FROM.  It returns the character position
  555.      where the scan stops.
  556.  
  557.      If DEPTH is nonzero, parenthesis depth counting begins from that
  558.      value.  The only candidates for stopping are places where the
  559.      depth in parentheses becomes zero; `scan-lists' counts COUNT such
  560.      places and then stops.  Thus, a positive value for DEPTH means go
  561.      out DEPTH levels of parenthesis.
  562.  
  563.      Scanning ignores comments if `parse-sexp-ignore-comments' is
  564.      non-`nil'.
  565.  
  566.      If the scan reaches the beginning or end of the buffer (or its
  567.      accessible portion), and the depth is not zero, an error is
  568.      signaled.  If the depth is zero but the count is not used up,
  569.      `nil' is returned.
  570.  
  571.      If optional arg BUFFER is non-`nil', scanning occurs in that
  572.      buffer instead of in the current buffer.
  573.  
  574.      If optional arg NOERROR is non-`nil', `scan-lists' will return
  575.      `nil' instead of signalling an error.
  576.  
  577.  - Function: scan-sexps FROM COUNT &optional BUFFER NOERROR
  578.      This function scans forward COUNT sexps from character position
  579.      FROM.  It returns the character position where the scan stops.
  580.  
  581.      Scanning ignores comments if `parse-sexp-ignore-comments' is
  582.      non-`nil'.
  583.  
  584.      If the scan reaches the beginning or end of (the accessible part
  585.      of) the buffer in the middle of a parenthetical grouping, an error
  586.      is signaled.  If it reaches the beginning or end between groupings
  587.      but before count is used up, `nil' is returned.
  588.  
  589.      If optional arg BUFFER is non-`nil', scanning occurs in that
  590.      buffer instead of in the current buffer.
  591.  
  592.      If optional arg NOERROR is non-`nil', `scan-sexps' will return nil
  593.      instead of signalling an error.
  594.  
  595.  - Variable: parse-sexp-ignore-comments
  596.      If the value is non-`nil', then comments are treated as whitespace
  597.      by the functions in this section and by `forward-sexp'.
  598.  
  599.      In older Emacs versions, this feature worked only when the comment
  600.      terminator is something like `*/', and appears only to end a
  601.      comment.  In languages where newlines terminate comments, it was
  602.      necessary make this variable `nil', since not every newline is the
  603.      end of a comment.  This limitation no longer exists.
  604.  
  605.    You can use `forward-comment' to move forward or backward over one
  606. comment or several comments.
  607.  
  608.  - Function: forward-comment COUNT &optional BUFFER
  609.      This function moves point forward across COUNT comments (backward,
  610.      if COUNT is negative).  If it finds anything other than a comment
  611.      or whitespace, it stops, leaving point at the place where it
  612.      stopped.  It also stops after satisfying COUNT.
  613.  
  614.      Optional argument BUFFER defaults to the current buffer.
  615.  
  616.    To move forward over all comments and whitespace following point, use
  617. `(forward-comment (buffer-size))'.  `(buffer-size)' is a good argument
  618. to use, because the number of comments in the buffer cannot exceed that
  619. many.
  620.  
  621. 
  622. File: lispref.info,  Node: Standard Syntax Tables,  Next: Syntax Table Internals,  Prev: Parsing Expressions,  Up: Syntax Tables
  623.  
  624. Some Standard Syntax Tables
  625. ===========================
  626.  
  627.    Most of the major modes in XEmacs have their own syntax tables.  Here
  628. are several of them:
  629.  
  630.  - Function: standard-syntax-table
  631.      This function returns the standard syntax table, which is the
  632.      syntax table used in Fundamental mode.
  633.  
  634.  - Variable: text-mode-syntax-table
  635.      The value of this variable is the syntax table used in Text mode.
  636.  
  637.  - Variable: c-mode-syntax-table
  638.      The value of this variable is the syntax table for C-mode buffers.
  639.  
  640.  - Variable: emacs-lisp-mode-syntax-table
  641.      The value of this variable is the syntax table used in Emacs Lisp
  642.      mode by editing commands.  (It has no effect on the Lisp `read'
  643.      function.)
  644.  
  645. 
  646. File: lispref.info,  Node: Syntax Table Internals,  Prev: Standard Syntax Tables,  Up: Syntax Tables
  647.  
  648. Syntax Table Internals
  649. ======================
  650.  
  651.    Each element of a syntax table is an integer that encodes the syntax
  652. of one character: the syntax class, possible matching character, and
  653. flags.  Lisp programs don't usually work with the elements directly; the
  654. Lisp-level syntax table functions usually work with syntax descriptors
  655. (*note Syntax Descriptors::.).
  656.  
  657.    The low 8 bits of each element of a syntax table indicate the syntax
  658. class.
  659.  
  660. Integer
  661.      Class
  662.  
  663. 0
  664.      whitespace
  665.  
  666. 1
  667.      punctuation
  668.  
  669. 2
  670.      word
  671.  
  672. 3
  673.      symbol
  674.  
  675. 4
  676.      open parenthesis
  677.  
  678. 5
  679.      close parenthesis
  680.  
  681. 6
  682.      expression prefix
  683.  
  684. 7
  685.      string quote
  686.  
  687. 8
  688.      paired delimiter
  689.  
  690. 9
  691.      escape
  692.  
  693. 10
  694.      character quote
  695.  
  696. 11
  697.      comment-start
  698.  
  699. 12
  700.      comment-end
  701.  
  702. 13
  703.      inherit
  704.  
  705.    The next 8 bits are the matching opposite parenthesis (if the
  706. character has parenthesis syntax); otherwise, they are not meaningful.
  707. The next 6 bits are the flags.
  708.  
  709. 
  710. File: lispref.info,  Node: Abbrevs,  Next: Extents,  Prev: Syntax Tables,  Up: Top
  711.  
  712. Abbrevs And Abbrev Expansion
  713. ****************************
  714.  
  715.    An abbreviation or "abbrev" is a string of characters that may be
  716. expanded to a longer string.  The user can insert the abbrev string and
  717. find it replaced automatically with the expansion of the abbrev.  This
  718. saves typing.
  719.  
  720.    The set of abbrevs currently in effect is recorded in an "abbrev
  721. table".  Each buffer has a local abbrev table, but normally all buffers
  722. in the same major mode share one abbrev table.  There is also a global
  723. abbrev table.  Normally both are used.
  724.  
  725.    An abbrev table is represented as an obarray containing a symbol for
  726. each abbreviation.  The symbol's name is the abbreviation; its value is
  727. the expansion; its function definition is the hook function to do the
  728. expansion (*note Defining Abbrevs::.); its property list cell contains
  729. the use count, the number of times the abbreviation has been expanded.
  730. Because these symbols are not interned in the usual obarray, they will
  731. never appear as the result of reading a Lisp expression; in fact,
  732. normally they are never used except by the code that handles abbrevs.
  733. Therefore, it is safe to use them in an extremely nonstandard way.
  734. *Note Creating Symbols::.
  735.  
  736.    For the user-level commands for abbrevs, see *Note Abbrev Mode:
  737. (emacs)Abbrevs.
  738.  
  739. * Menu:
  740.  
  741. * Abbrev Mode::                 Setting up XEmacs for abbreviation.
  742. * Tables: Abbrev Tables.        Creating and working with abbrev tables.
  743. * Defining Abbrevs::            Specifying abbreviations and their expansions.
  744. * Files: Abbrev Files.          Saving abbrevs in files.
  745. * Expansion: Abbrev Expansion.  Controlling expansion; expansion subroutines.
  746. * Standard Abbrev Tables::      Abbrev tables used by various major modes.
  747.  
  748. 
  749. File: lispref.info,  Node: Abbrev Mode,  Next: Abbrev Tables,  Up: Abbrevs
  750.  
  751. Setting Up Abbrev Mode
  752. ======================
  753.  
  754.    Abbrev mode is a minor mode controlled by the value of the variable
  755. `abbrev-mode'.
  756.  
  757.  - Variable: abbrev-mode
  758.      A non-`nil' value of this variable turns on the automatic expansion
  759.      of abbrevs when their abbreviations are inserted into a buffer.
  760.      If the value is `nil', abbrevs may be defined, but they are not
  761.      expanded automatically.
  762.  
  763.      This variable automatically becomes local when set in any fashion.
  764.  
  765.  - Variable: default-abbrev-mode
  766.      This is the value of `abbrev-mode' for buffers that do not
  767.      override it.  This is the same as `(default-value 'abbrev-mode)'.
  768.  
  769. 
  770. File: lispref.info,  Node: Abbrev Tables,  Next: Defining Abbrevs,  Prev: Abbrev Mode,  Up: Abbrevs
  771.  
  772. Abbrev Tables
  773. =============
  774.  
  775.    This section describes how to create and manipulate abbrev tables.
  776.  
  777.  - Function: make-abbrev-table
  778.      This function creates and returns a new, empty abbrev table--an
  779.      obarray containing no symbols.  It is a vector filled with zeros.
  780.  
  781.  - Function: clear-abbrev-table TABLE
  782.      This function undefines all the abbrevs in abbrev table TABLE,
  783.      leaving it empty.  The function returns `nil'.
  784.  
  785.  - Function: define-abbrev-table TABNAME DEFINITIONS
  786.      This function defines TABNAME (a symbol) as an abbrev table name,
  787.      i.e., as a variable whose value is an abbrev table.  It defines
  788.      abbrevs in the table according to DEFINITIONS, a list of elements
  789.      of the form `(ABBREVNAME EXPANSION HOOK USECOUNT)'.  The value is
  790.      always `nil'.
  791.  
  792.  - Variable: abbrev-table-name-list
  793.      This is a list of symbols whose values are abbrev tables.
  794.      `define-abbrev-table' adds the new abbrev table name to this list.
  795.  
  796.  - Function: insert-abbrev-table-description NAME &optional HUMAN
  797.      This function inserts before point a description of the abbrev
  798.      table named NAME.  The argument NAME is a symbol whose value is an
  799.      abbrev table.  The value is always `nil'.
  800.  
  801.      If HUMAN is non-`nil', the description is human-oriented.
  802.      Otherwise the description is a Lisp expression--a call to
  803.      `define-abbrev-table' that would define NAME exactly as it is
  804.      currently defined.
  805.  
  806. 
  807. File: lispref.info,  Node: Defining Abbrevs,  Next: Abbrev Files,  Prev: Abbrev Tables,  Up: Abbrevs
  808.  
  809. Defining Abbrevs
  810. ================
  811.  
  812.    These functions define an abbrev in a specified abbrev table.
  813. `define-abbrev' is the low-level basic function, while `add-abbrev' is
  814. used by commands that ask for information from the user.
  815.  
  816.  - Function: add-abbrev TABLE TYPE ARG
  817.      This function adds an abbreviation to abbrev table TABLE based on
  818.      information from the user.  The argument TYPE is a string
  819.      describing in English the kind of abbrev this will be (typically,
  820.      `"global"' or `"mode-specific"'); this is used in prompting the
  821.      user.  The argument ARG is the number of words in the expansion.
  822.  
  823.      The return value is the symbol that internally represents the new
  824.      abbrev, or `nil' if the user declines to confirm redefining an
  825.      existing abbrev.
  826.  
  827.  - Function: define-abbrev TABLE NAME EXPANSION HOOK
  828.      This function defines an abbrev in TABLE named NAME, to expand to
  829.      EXPANSION, and call HOOK.  The return value is an uninterned
  830.      symbol that represents the abbrev inside XEmacs; its name is NAME.
  831.  
  832.      The argument NAME should be a string.  The argument EXPANSION
  833.      should be a string, or `nil' to undefine the abbrev.
  834.  
  835.      The argument HOOK is a function or `nil'.  If HOOK is non-`nil',
  836.      then it is called with no arguments after the abbrev is replaced
  837.      with EXPANSION; point is located at the end of EXPANSION when HOOK
  838.      is called.
  839.  
  840.      The use count of the abbrev is initialized to zero.
  841.  
  842.  - User Option: only-global-abbrevs
  843.      If this variable is non-`nil', it means that the user plans to use
  844.      global abbrevs only.  This tells the commands that define
  845.      mode-specific abbrevs to define global ones instead.  This
  846.      variable does not alter the behavior of the functions in this
  847.      section; it is examined by their callers.
  848.  
  849. 
  850. File: lispref.info,  Node: Abbrev Files,  Next: Abbrev Expansion,  Prev: Defining Abbrevs,  Up: Abbrevs
  851.  
  852. Saving Abbrevs in Files
  853. =======================
  854.  
  855.    A file of saved abbrev definitions is actually a file of Lisp code.
  856. The abbrevs are saved in the form of a Lisp program to define the same
  857. abbrev tables with the same contents.  Therefore, you can load the file
  858. with `load' (*note How Programs Do Loading::.).  However, the function
  859. `quietly-read-abbrev-file' is provided as a more convenient interface.
  860.  
  861.    User-level facilities such as `save-some-buffers' can save abbrevs
  862. in a file automatically, under the control of variables described here.
  863.  
  864.  - User Option: abbrev-file-name
  865.      This is the default file name for reading and saving abbrevs.
  866.  
  867.  - Function: quietly-read-abbrev-file FILENAME
  868.      This function reads abbrev definitions from a file named FILENAME,
  869.      previously written with `write-abbrev-file'.  If FILENAME is
  870.      `nil', the file specified in `abbrev-file-name' is used.
  871.      `save-abbrevs' is set to `t' so that changes will be saved.
  872.  
  873.      This function does not display any messages.  It returns `nil'.
  874.  
  875.  - User Option: save-abbrevs
  876.      A non-`nil' value for `save-abbrev' means that XEmacs should save
  877.      abbrevs when files are saved.  `abbrev-file-name' specifies the
  878.      file to save the abbrevs in.
  879.  
  880.  - Variable: abbrevs-changed
  881.      This variable is set non-`nil' by defining or altering any
  882.      abbrevs.  This serves as a flag for various XEmacs commands to
  883.      offer to save your abbrevs.
  884.  
  885.  - Command: write-abbrev-file FILENAME
  886.      Save all abbrev definitions, in all abbrev tables, in the file
  887.      FILENAME, in the form of a Lisp program that when loaded will
  888.      define the same abbrevs.  This function returns `nil'.
  889.  
  890. 
  891. File: lispref.info,  Node: Abbrev Expansion,  Next: Standard Abbrev Tables,  Prev: Abbrev Files,  Up: Abbrevs
  892.  
  893. Looking Up and Expanding Abbreviations
  894. ======================================
  895.  
  896.    Abbrevs are usually expanded by commands for interactive use,
  897. including `self-insert-command'.  This section describes the
  898. subroutines used in writing such functions, as well as the variables
  899. they use for communication.
  900.  
  901.  - Function: abbrev-symbol ABBREV &optional TABLE
  902.      This function returns the symbol representing the abbrev named
  903.      ABBREV.  The value returned is `nil' if that abbrev is not
  904.      defined.  The optional second argument TABLE is the abbrev table
  905.      to look it up in.  If TABLE is `nil', this function tries first
  906.      the current buffer's local abbrev table, and second the global
  907.      abbrev table.
  908.  
  909.  - Function: abbrev-expansion ABBREV &optional TABLE
  910.      This function returns the string that ABBREV would expand into (as
  911.      defined by the abbrev tables used for the current buffer).  The
  912.      optional argument TABLE specifies the abbrev table to use, as in
  913.      `abbrev-symbol'.
  914.  
  915.  - Command: expand-abbrev
  916.      This command expands the abbrev before point, if any.  If point
  917.      does not follow an abbrev, this command does nothing.  The command
  918.      returns `t' if it did expansion, `nil' otherwise.
  919.  
  920.  - Command: abbrev-prefix-mark &optional ARG
  921.      Mark current point as the beginning of an abbrev.  The next call to
  922.      `expand-abbrev' will use the text from here to point (where it is
  923.      then) as the abbrev to expand, rather than using the previous word
  924.      as usual.
  925.  
  926.  - User Option: abbrev-all-caps
  927.      When this is set non-`nil', an abbrev entered entirely in upper
  928.      case is expanded using all upper case.  Otherwise, an abbrev
  929.      entered entirely in upper case is expanded by capitalizing each
  930.      word of the expansion.
  931.  
  932.  - Variable: abbrev-start-location
  933.      This is the buffer position for `expand-abbrev' to use as the start
  934.      of the next abbrev to be expanded.  (`nil' means use the word
  935.      before point instead.)  `abbrev-start-location' is set to `nil'
  936.      each time `expand-abbrev' is called.  This variable is also set by
  937.      `abbrev-prefix-mark'.
  938.  
  939.  - Variable: abbrev-start-location-buffer
  940.      The value of this variable is the buffer for which
  941.      `abbrev-start-location' has been set.  Trying to expand an abbrev
  942.      in any other buffer clears `abbrev-start-location'.  This variable
  943.      is set by `abbrev-prefix-mark'.
  944.  
  945.  - Variable: last-abbrev
  946.      This is the `abbrev-symbol' of the last abbrev expanded.  This
  947.      information is left by `expand-abbrev' for the sake of the
  948.      `unexpand-abbrev' command.
  949.  
  950.  - Variable: last-abbrev-location
  951.      This is the location of the last abbrev expanded.  This contains
  952.      information left by `expand-abbrev' for the sake of the
  953.      `unexpand-abbrev' command.
  954.  
  955.  - Variable: last-abbrev-text
  956.      This is the exact expansion text of the last abbrev expanded,
  957.      after case conversion (if any).  Its value is `nil' if the abbrev
  958.      has already been unexpanded.  This contains information left by
  959.      `expand-abbrev' for the sake of the `unexpand-abbrev' command.
  960.  
  961.  - Variable: pre-abbrev-expand-hook
  962.      This is a normal hook whose functions are executed, in sequence,
  963.      just before any expansion of an abbrev.  *Note Hooks::.  Since it
  964.      is a normal hook, the hook functions receive no arguments.
  965.      However, they can find the abbrev to be expanded by looking in the
  966.      buffer before point.
  967.  
  968.    The following sample code shows a simple use of
  969. `pre-abbrev-expand-hook'.  If the user terminates an abbrev with a
  970. punctuation character, the hook function asks for confirmation.  Thus,
  971. this hook allows the user to decide whether to expand the abbrev, and
  972. aborts expansion if it is not confirmed.
  973.  
  974.      (add-hook 'pre-abbrev-expand-hook 'query-if-not-space)
  975.      
  976.      ;; This is the function invoked by `pre-abbrev-expand-hook'.
  977.      
  978.      ;; If the user terminated the abbrev with a space, the function does
  979.      ;; nothing (that is, it returns so that the abbrev can expand).  If the
  980.      ;; user entered some other character, this function asks whether
  981.      ;; expansion should continue.
  982.      
  983.      ;; If the user answers the prompt with `y', the function returns
  984.      ;; `nil' (because of the `not' function), but that is
  985.      ;; acceptable; the return value has no effect on expansion.
  986.      
  987.      (defun query-if-not-space ()
  988.        (if (/= ?\  (preceding-char))
  989.            (if (not (y-or-n-p "Do you want to expand this abbrev? "))
  990.                (error "Not expanding this abbrev"))))
  991.  
  992. 
  993. File: lispref.info,  Node: Standard Abbrev Tables,  Prev: Abbrev Expansion,  Up: Abbrevs
  994.  
  995. Standard Abbrev Tables
  996. ======================
  997.  
  998.    Here we list the variables that hold the abbrev tables for the
  999. preloaded major modes of XEmacs.
  1000.  
  1001.  - Variable: global-abbrev-table
  1002.      This is the abbrev table for mode-independent abbrevs.  The abbrevs
  1003.      defined in it apply to all buffers.  Each buffer may also have a
  1004.      local abbrev table, whose abbrev definitions take precedence over
  1005.      those in the global table.
  1006.  
  1007.  - Variable: local-abbrev-table
  1008.      The value of this buffer-local variable is the (mode-specific)
  1009.      abbreviation table of the current buffer.
  1010.  
  1011.  - Variable: fundamental-mode-abbrev-table
  1012.      This is the local abbrev table used in Fundamental mode; in other
  1013.      words, it is the local abbrev table in all buffers in Fundamental
  1014.      mode.
  1015.  
  1016.  - Variable: text-mode-abbrev-table
  1017.      This is the local abbrev table used in Text mode.
  1018.  
  1019.  - Variable: c-mode-abbrev-table
  1020.      This is the local abbrev table used in C mode.
  1021.  
  1022.  - Variable: lisp-mode-abbrev-table
  1023.      This is the local abbrev table used in Lisp mode and Emacs Lisp
  1024.      mode.
  1025.  
  1026. 
  1027. File: lispref.info,  Node: Extents,  Next: Specifiers,  Prev: Abbrevs,  Up: Top
  1028.  
  1029. Extents
  1030. *******
  1031.  
  1032.    An "extent" is a region of text (a start position and an end
  1033. position) that is displayed in a particular face and can have certain
  1034. other properties such as being read-only.  Extents can overlap each
  1035. other.  XEmacs efficiently handles buffers with large numbers of
  1036. extents in them.
  1037.  
  1038.  - Function: extentp OBJECT
  1039.      This returns `t' if OBJECT is an extent.
  1040.  
  1041. * Menu:
  1042.  
  1043. * Intro to Extents::       Extents are regions over a buffer or string.
  1044. * Creating and Modifying Extents::
  1045.                Basic extent functions.
  1046. * Extent Endpoints::       Accessing and setting the bounds of an extent.
  1047. * Finding Extents::       Determining which extents are in an object.
  1048. * Mapping Over Extents::   More sophisticated functions for extent scanning.
  1049. * Extent Properties::       Extents have built-in and user-definable properties.
  1050. * Detached Extents::       Extents that are not in a buffer.
  1051. * Extent Parents::         Inheriting properties from another extent.
  1052. * Duplicable Extents::       Extents can be marked to be copied into strings.
  1053. * Extents and Events::       Extents can interact with the keyboard and mouse.
  1054. * Atomic Extents::       Treating a block of text as a single entity.
  1055.  
  1056. 
  1057. File: lispref.info,  Node: Intro to Extents,  Next: Creating and Modifying Extents,  Up: Extents
  1058.  
  1059. Introduction to Extents
  1060. =======================
  1061.  
  1062.    An extent is a region of text within a buffer or string that has
  1063. certain properties associated with it.  The properties of an extent
  1064. primarily affect the way the text contained in the extent is displayed.
  1065. Extents can freely overlap each other in a buffer or string.  Extents
  1066. are invisible to functions that merely examine the text of a buffer or
  1067. string.
  1068.  
  1069.    *NOTE*: An alternative way to add properties to a buffer or string
  1070. is to use text properties.  *Note Text Properties::.
  1071.  
  1072.    An extent is logically a Lisp object consisting of a start position,
  1073. an end position, a buffer or string to which these positions refer, and
  1074. a property list.  As text is inserted into a buffer, the start and end
  1075. positions of the extent are automatically adjusted as necessary to keep
  1076. the extent referring to the same text in the buffer.  If text is
  1077. inserted at the boundary of an extent, the extent's `start-open' and
  1078. `end-open' properties control whether the text is included as part of
  1079. the extent.  If the text bounded by an extent is deleted, the extent
  1080. becomes "detached"; its start and end positions are no longer
  1081. meaningful, but it maintains all its other properties and can later be
  1082. reinserted into a buffer. (None of these considerations apply to
  1083. strings, because text cannot be inserted into or deleted from a string.)
  1084.  
  1085.    Each extent has a face or list of faces associated with it, which
  1086. controls the way in which the text bounded by the extent is displayed.
  1087. If an extent's face is `nil' or its properties are partially undefined,
  1088. the corresponding properties from the default face for the frame is
  1089. used.  If two or more extents overlap, or if a list of more than one
  1090. face is specified for a particular extent, the corresponding faces are
  1091. merged to determine the text's displayed properties.  Every extent has
  1092. a "priority" that determines which face takes precedence if the faces
  1093. conflict. (If two extents have the same priority, the one that comes
  1094. later in the display order takes precedence.  *Note display order:
  1095. Extent Endpoints.) Higher-numbered priority values correspond to a
  1096. higher priority, and priority values can be negative.  Every extent is
  1097. created with a priority of 0, but this can be changed with
  1098. `set-extent-priority'.  Within a single extent with a list of faces,
  1099. faces earlier in the list have a higher priority than faces later in
  1100. the list.
  1101.  
  1102.    Extents can be set to respond specially to key and mouse events
  1103. within the extent.  An extent's `keymap' property controls the effect of
  1104. key and mouse strokes within the extent's text, and the `mouse-face'
  1105. property controls whether the extent is highlighted when the mouse moves
  1106. over it.  *Note Extents and Events::.
  1107.  
  1108.    An extent can optionally have a "begin-glyph" or "end-glyph"
  1109. associated with it.  A begin-glyph or end-glyph is a pixmap or string
  1110. that will be displayed either at the start or end of an extent or in the
  1111. margin of the line that the start or end of the extent lies in,
  1112. depending on the extent's layout policy.  Begin-glyphs and end-glyphs
  1113. are used to implement annotations, and you should use the annotation API
  1114. functions in preference to the lower-level extent functions.  For more
  1115. information, *Note Annotations::.
  1116.  
  1117.    If an extent has its `detachable' property set, it will become
  1118. "detached" (i.e. no longer in the buffer) when all its text its
  1119. deleted.  Otherwise, it will simply shrink down to zero-length and sit
  1120. it the same place in the buffer.  By default, the `detachable' property
  1121. is set on newly-created extents.  *Note Detached Extents::.
  1122.  
  1123.    If an extent has its `duplicable' property set, it will be
  1124. remembered when a string is created from text bounded by the extent.
  1125. When the string is re-inserted into a buffer, the extent will also be
  1126. re-inserted.  This mechanism is used in the kill, yank, and undo
  1127. commands.  *Note Duplicable Extents::.
  1128.  
  1129. 
  1130. File: lispref.info,  Node: Creating and Modifying Extents,  Next: Extent Endpoints,  Prev: Intro to Extents,  Up: Extents
  1131.  
  1132. Creating and Modifying Extents
  1133. ==============================
  1134.  
  1135.  - Function: make-extent FROM TO &optional OBJECT
  1136.      This function makes an extent for the range [FROM, TO) in OBJECT
  1137.      (a buffer or string).  OBJECT defaults to the current buffer.
  1138.      Insertions at point TO will be outside of the extent; insertions
  1139.      at FROM will be inside the extent, causing the extent to grow
  1140.      (*note Extent Endpoints::.).  This is the same way that markers
  1141.      behave.  The extent is initially detached if both FROM and TO are
  1142.      `nil', and in this case OBJECT defaults to `nil', meaning the
  1143.      extent is in no buffer or string (*note Detached Extents::.).
  1144.  
  1145.  - Function: delete-extent EXTENT
  1146.      This function removes EXTENT from its buffer and destroys it.
  1147.      This does not modify the buffer's text, only its display
  1148.      properties.  The extent cannot be used thereafter.  To remove an
  1149.      extent in such a way that it can be re-inserted later, use
  1150.      `detach-extent'.  *Note Detached Extents::.
  1151.  
  1152.  - Function: extent-object EXTENT
  1153.      This function returns the buffer or string that EXTENT is in.  If
  1154.      the return value is `nil', this means that the extent is detached;
  1155.      however, a detached extent will not necessarily return a value of
  1156.      `nil'.
  1157.  
  1158.  - Function: extent-live-p EXTENT
  1159.      This function returns `nil' if EXTENT is deleted, and `t'
  1160.      otherwise.
  1161.  
  1162.